package com.Smart.smartscals.Utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.Smart.smartscals.Entity.EntityConversionTime;

public class MSConversionToValues {
	public EntityConversionTime mSConverTOValues(long date){
		
		EntityConversionTime timeEntity = new EntityConversionTime();
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		
		String allTime = format.format(date);
		//������ݡ��·ݡ�����
		timeEntity.setYearNUM(Integer.parseInt(allTime.substring(0, 4)));
		timeEntity.setMonthNUM(Integer.parseInt(allTime.substring(5, 7)));
		timeEntity.setDayNUM(Integer.parseInt(allTime.substring(8)));
		try {
			Date mdate = format.parse(allTime);
			Calendar cd = Calendar.getInstance();   
			cd.setTime(mdate);   
			int weekNUM = cd.get(Calendar.DAY_OF_WEEK);
			//����������
			timeEntity.setWeekNUM(weekNUM-1);
			
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		return timeEntity;

	}
}
